﻿using System;
using MugenInjection.Delegates;
using MugenInjection.Interface;

namespace MugenInjection.Syntax.Type
{
    /// <summary>
    ///     Specific fluent syntax for type binding.
    /// </summary>
    public interface ITypeCallbackSyntax : IBindingBuilder
    {
        /// <summary>
        ///   Indicates that the binding should executes callback method before binding activated.
        /// </summary>
        /// <param name="onActivating">The specified callback method.</param>
        /// <returns>The fluent syntax.</returns>
        ITypeCallbackObjectUseWithSyntax OnActivating(Action<IBindingContext> onActivating);

        /// <summary>
        ///     Indicates that the binding should executes callback method after binding activated.
        /// </summary>
        /// <param name="onActivated">The specified callback method.</param>
        /// <returns>The fluent syntax.</returns>
        ITypeCallbackObjectUseWithSyntax OnActivated(Action<object> onActivated);

        /// <summary>
        ///     Indicates that the binding should executes callback method after binding activated.
        /// </summary>
        /// <param name="onActivated">The specified callback method.</param>
        /// <returns>The fluent syntax.</returns>
        ITypeCallbackObjectUseWithSyntax OnActivated(BindingActivatedDelegate<object> onActivated);

        /// <summary>
        ///     Indicates that the binding should executes callback that should be called before instances will be released.
        /// </summary>
        /// <param name="onReleaseObject">The specified callback method.</param>
        /// <returns>The fluent syntax.</returns>
        ITypeCallbackObjectUseWithSyntax OnReleaseObject(Action<object, bool> onReleaseObject);

        /// <summary>
        ///     Indicates that the binding should executes callback method after binding disposed.
        /// </summary>
        /// <param name="onDisposed">The specified callback method.</param>
        /// <returns>The fluent syntax.</returns>
        ITypeCallbackObjectUseWithSyntax OnDisposed(Action<IBinding> onDisposed);
    }

    /// <summary>
    ///     Specific fluent syntax for type binding.
    /// </summary>
    public interface ITypeCallbackSyntax<T> : IBindingBuilder
    {
        /// <summary>
        ///     Indicates that the binding should executes callback method before binding activated.
        /// </summary>
        /// <param name="onActivating">The specified callback method.</param>
        /// <returns>The fluent syntax.</returns>
        ITypeCallbackObjectUseWithSyntax<T> OnActivating(Action<IBindingContext> onActivating);

        /// <summary>
        ///     Indicates that the binding should executes callback method after binding activated.
        /// </summary>
        /// <param name="onActivated">The specified callback method.</param>
        /// <returns>The fluent syntax.</returns>
        ITypeCallbackObjectUseWithSyntax<T> OnActivated(Action<T> onActivated);

        /// <summary>
        ///     Indicates that the binding should executes callback method after binding activated.
        /// </summary>
        /// <param name="onActivated">The specified callback method.</param>
        /// <returns>The fluent syntax.</returns>
        ITypeCallbackObjectUseWithSyntax<T> OnActivated(BindingActivatedDelegate<T> onActivated);

        /// <summary>
        ///     Indicates that the binding should executes callback that should be called before instances will be released.
        /// </summary>
        /// <param name="onReleaseObject">The specified callback method.</param>
        /// <returns>The fluent syntax.</returns>
        ITypeCallbackObjectUseWithSyntax<T> OnReleaseObject(Action<T, bool> onReleaseObject);

        /// <summary>
        ///     Indicates that the binding should executes callback method after binding disposed.
        /// </summary>
        /// <param name="onDisposed">The specified callback method.</param>
        /// <returns>The fluent syntax.</returns>
        ITypeCallbackObjectUseWithSyntax<T> OnDisposed(Action<IBinding> onDisposed);
    }
}